<?php
/**
 * 
 * 激活或禁用员账户
 * @author LeoNing
 *
 */
class ActiveVip extends Action {
	/* (non-PHPdoc)
	 * @see Action::execute()
	 */
	public function execute($params) {
		$me = check_login ( ADMIN_LOGIN_PAGE );
		if (rqset ( 'uids' )) {
			$where ['uid IN'] = safe_ids ( rqst ( 'uids' ), ',', true );
		} else {
			$where ['uid'] = irqst ( 'uid' );
		}
		$status = rqst ( 'status', 'actived' );
		$status = $status == 'actived' ? 'actived' : 'inactived';
		$userModel = new VipUserModel ();
		$rst = $userModel->update ( array ('status' => $status ), $where );
		if ($rst === false) {
			Response::errorPage ( ($status == 1 ? "禁用" : "激活") . "会员失败。<p>" . $userModel->last_error_msg () . "</p>", $this->referer );
		} else {
			Response::redirect ( $this->referer );
		}
	}
}